package com.fish.anne.service.impl;

import java.util.List;

import com.fish.anne.dao.AutoDao;
import com.fish.anne.model.Auto;
import com.fish.anne.service.AutoManager;
import com.fish.anne.webapp.formbean.AutoSearch;
import com.fish.anne.webapp.formbean.FrontAutoSearch;

 public class AutoManagerImpl extends GenericManagerImpl<Auto, Long> implements AutoManager {
    AutoDao autoDao;

    public AutoManagerImpl(AutoDao autoDao) {
        super(autoDao);
        this.autoDao = autoDao;
    }
    public List<Auto> findByBrandId(Integer brandId){
    	return autoDao.findByBrandId(brandId);
    }
    
    public List<Auto> findCheapAutos(){
    	List<Auto> re = autoDao.findCheapAutos();
    	return re;
    }
    
    public boolean isBrandUsed(Integer brandId){
    	List<Auto> autos = autoDao.findByBrandId(brandId);
    	if(autos==null || autos.isEmpty() ){
    		return false;
    		
    	}
    	return true;	
    		
    }
	public List<Auto> findByMember(FrontAutoSearch frontAutoSearch) {
 		return autoDao.findByMember(frontAutoSearch);
	}
	public Long getCountByMember(FrontAutoSearch frontAutoSearch) {
 		return autoDao.getCountByMember(frontAutoSearch);
	}
	
	public Long getCountOfSearch(AutoSearch autoSearch){
		return this.autoDao.getCountOfSearch(autoSearch);
	}
	public List<Auto> findBySearch(AutoSearch autoSearch){
		return this.autoDao.findBySearch(autoSearch);
	}
}